Welcome to my website!

This is Big Quiz game. This consists in answer the questions clcking on the answers of the boxes. I modified this code using different colours, adding more questions and answers, puting it on full screen an moving the boxes too.

This is the modified code:


import pgzrun
import pygame


WIDTH = 1350
HEIGHT = 700

main_box = Rect(0, 0, 1250, 350)
timer_box = Rect(0, 0, 100, 80)
answer_box1 = Rect(0, 0, 375, 150)
answer_box2 = Rect(0, 0, 375, 150)
answer_box3 = Rect(0, 0, 375, 150)
answer_box4 = Rect(0, 0, 375, 150)

main_box.move_ip(50, 40)
timer_box.move_ip(10, 30)
answer_box1.move_ip(200, 400)
answer_box2.move_ip(750, 400)
answer_box3.move_ip(200, 600)
answer_box4.move_ip(750, 600)
answer_boxes = [answer_box1, answer_box2, answer_box3, answer_box4]

score = 0
time_left = 10

q1 = ["Which country is the first in the Gini Index?",
      "Panama", "South Africa", "Namibbia", "Siria", 2]

q2 = ["Which is the richest busisness?",
      "Apple", "Amazon", "Google", "Intel", 1]

q3 = ["What is the country with the lowest unemployment?",
      "Spain", "Greece", "China", "Japan", 4]

q4 = ["Who is the richest person right now?",
      "Elon Musk", "Jeff Bezos", "Ralph Lauren", "Amancio Ortega", 1]

q5 = ["Which of these countries has the highest GDP?",
      "India", "China", "Morocco", "Canada",2]

q6 = ["What is the capital?",
      "Money", "A house", "A car", "All of them are correct", 4]

q7 = ["What is the income of a busissness?",
      "The money it does", "The money it wants", "The  money it expends", "The objects that it sells", 1]

q8 = ["Who is the actual president of the USA?",
      "Joe Biden", "John F. Kennedy", "Donald Trump", "Michael Jordan", 1]

q9 = ["When was made the first Bitcoin?",
      "1999", "2005", "2007", "2009", 4]

q10 = ["What sport makes the more money?",
      "American Football", "Baseball", "Golf", "Basketball", 1]

questions = [q1, q2, q3, q4, q5, q6, q7, q8, q9, q10]
question = questions.pop(0)

def draw():
    screen.surface = pygame.display.set_mode((WIDTH, HEIGHT), pygame.FULLSCREEN)
    screen.fill("grey")
    screen.draw.filled_rect(main_box, "yellow2")
    screen.draw.filled_rect(timer_box, "red2")


    for box in answer_boxes:
        screen.draw.filled_rect(box, "darkorchid2")

    screen.draw.textbox(str(time_left), timer_box, color=("black"))
    screen.draw.textbox(question[0], main_box, color=("black"))

    index= 1
    for box in answer_boxes:
        screen.draw.textbox(question[index], box, color=("black"))
        index = index + 1

def game_over():
    global question, time_left
    message = "Game over. You got %s questions correct" % str(score)
    question = [message, "-", "-", "-", "-", 5]
    time_left = 0

def correct_answer():
    global question, score, time_left

    score = score + 1
    if questions:
        question = questions.pop(0)
        time_left = 10
    else:
        print("End of questions")
        game_over()

def on_mouse_down(pos):
    index = 1
    for box in answer_boxes:
        if box.collidepoint(pos):
            print("Clicked on answer" + str(index))
            if index == question[5]:
                print("You got it correct!")
                correct_answer()
            else:
                game_over()
        index = index + 1

def update_time_left():
    global time_left

    if time_left:
        time_left = time_left - 1
    else:
        game_over()

clock.schedule_interval(update_time_left, 1.0)
pgzrun.go()